// =================================================================================================
//
//	CopyEngine Framework
//	Copyright 2012 Eran. All Rights Reserved.
//
//	This program is free software. You can redistribute and/or modify it
//	in accordance with the terms of the accompanying license agreement.
//
// =================================================================================================

package data.vo
{
    public class LayoutItemVoPropertyPorxy
    {
        private var mTarget:LayoutItemVo;
        private var mPropertyType:int;

        public function LayoutItemVoPropertyPorxy(_target:LayoutItemVo, _propertyType:int)
        {
            mTarget = _target;
            mPropertyType = _propertyType;
        }


        //=======================
        //==Relative Target
        //=======================

        public function get relativeTarget():String
        {
            return mPropertyType == GlobalConfig.LAYOUT_ITEM_VO_PROPERTY_TYPE_X ?
                    mTarget.relativeTargetX : mTarget.relativeTargetY;

        }

        public function set relativeTarget(_value:String):void
        {
            if (mPropertyType == GlobalConfig.LAYOUT_ITEM_VO_PROPERTY_TYPE_X)
            {
                mTarget.relativeTargetX = _value;
            }
            else
            {
                mTarget.relativeTargetY = _value;
            }
        }

        //========================
        //==Relative Value Type
        //========================

        public function get relativeValueType():int
        {
            return mPropertyType == GlobalConfig.LAYOUT_ITEM_VO_PROPERTY_TYPE_X ?
                    mTarget.relativeValueTypeX : mTarget.relativeValueTypeY;

        }

        public function set relativeValueType(_value:int):void
        {
            if (mPropertyType == GlobalConfig.LAYOUT_ITEM_VO_PROPERTY_TYPE_X)
            {
                mTarget.relativeValueTypeX = _value;
            }
            else
            {
                mTarget.relativeValueTypeY = _value;
            }
        }

        //=========================
        //==Relative Value
        //=========================

        public function get relativeValue():int
        {
            return mPropertyType == GlobalConfig.LAYOUT_ITEM_VO_PROPERTY_TYPE_X ?
                    mTarget.relativeValueX : mTarget.relativeValueY;
        }

        public function set relativeValue(_value:int):void
        {
            if (mPropertyType == GlobalConfig.LAYOUT_ITEM_VO_PROPERTY_TYPE_X)
            {
                mTarget.relativeValueX = _value;
            }
            else
            {
                mTarget.relativeValueY = _value;
            }
        }


    }
}
